<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<title>有效时段设置</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery.pagination.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/http.js"></script>
<script type="text/javascript" src="../../js/alert.js"></script>
<script type="text/javascript" src="../../js/jquery-ui/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../js/jquery-ui/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.css">
</head>
<body>
	<div class="right_mainH4">
		<p>
			有效时段设置<small>Control panel</small>
		</p>
	</div>
	<div>
		<form role="form" style="padding: 10px 0 10px 20px;">
			<span>查询</span>
			<select id="query" style="width: 90px;">
				<option value="请选择">-请选择-</option>
				<option value="name">名称</option>
				<option value="phone">联系电话</option>
				<option value="licnum">经营许可证编号</option>
			</select>
			<input type="text" id="keywords" placeholder="Key" style="width:120px;">
	
			<button type="button" onclick="searchPage(1,10);" class="btn btn-success">查询</button>
			<button type="button" onclick="addEffectTime();" class="btn btn-success">根据地区设置有效时段</button>
		</form>
	</div>
	
	<table class="table table-bordered" id="datas">
		<tr>
			<td name="ids">ID</td>
			<td name="cityOrArea">行政区划</td>
			<td name="name">培训机构名称</td>
			<td name="contact">联系人</td>
			<td name="phone">联系电话</td>
			<td name="busiscope">经营范围 </td>
			<td name="id" id="id" other="effectTime">操作</td>
		</tr>
	</table>
	
	<!-- 分页控件 -->
    <div class="pager">
    </div>
    
     <!-- 有效时段 -->
     <div id="effectTimeDiv" style="display:none;" title="有效时段信息">
     	<iframe src="" style="width:100%;height: 100%" frameborder="no" marginwidth="0" marginheight="0" allowtransparency="yes"></iframe>
     </div>
     <!-- 根据地区设置有效时段 -->
     <div id="addEffectTimeDiv" style="display:none;" title="据地区设置有效时段">
     	<iframe src="" style="width:100%;height: 100%" frameborder="no" marginwidth="0" marginheight="0" allowtransparency="yes"></iframe>
     </div>
     <div id="addEffectTimeInfoDiv" style="display: none;" title="设置有效时间段">
		<form id="addEffectTimeInfoForm">
			<table class="table table-bordered .table-condensed">
				<tr>
					<td>实车教学有效时段起:</td>
					<td>
						<input type="text" id="ss14"  name="carTeachTimeS" />
					</td>
					<td>实车教学有效时段止:</td>
					<td>
						<input type="text" id="ss15" name="carTeachTimeE" />
					</td>
				</tr>
				<tr>
					<td>课堂和模拟教学有效时段起:</td>
					<td>
						<input type="text" id="ss16"  name="classTeachTimeS" />
					</td>
					<td>课堂和模拟教学有效时段止:</td>
					<td>
						<input type="text" id="ss17"  name="classTeachTimeE" />
					</td>
				</tr>
				<tr>
					<td>远程教学有效时段起:</td>
					<td>
						<input type="text" id="ss18"  name="onlineTimeS"  />
					</td>
					<td>远程教学有效时段止:</td>
					<td>
						<input type="text" id="ss19"  name="onlineTimeE" />
					</td>
				</tr>
			</table>
		</form>
		<div style="text-align: center;">
			<a href="javascript:void(0);" onclick="bindTime();" style="color:#FFF;" class="btn btn-info">绑定</a>
			<a href="javascript:void(0);" onclick="quit();" style="color:#FFF;" class="btn btn-success">取消</a>
			
		</div>
		
	</div>
    <script type="text/javascript">
    	searchPage(1,10);
    	
    	//分页查询
    	function searchPage(pageNo,pageSize){
    		$.ajax({
    			url : "../../school/find.ao",
    			type : 'POST',
    			data : {
    				"pageNo" : pageNo,
    				"pageSize" : pageSize,
    				"query" : $("#query").val(),
    				"keywords" : $("#keywords").val()
    			},
    			beforeSend : ajaxstar,
    			complete : ajaxend,
    			cache : false,
    			dataType : "json",
    			success : function(data) {
    				if (data["state"] == "success") {
    					insertTr(data, 0);
    				} else {
    					sAlert(data["result"]);
    				}
    			}
    		});
    	}
    	
    	//查看明细
    	function look(id){
			$("#effectTimeDiv").find("iframe").attr("src","info.html?id="+id);
			$("#effectTimeDiv").dialog({
				title : "学员信息",
				resizable : false,
				width : 850,
				height : 600,
				resizable : true,
				modal : true,
				buttons : {
					"关闭" : function() {
						$(this).dialog("close");
					}
				}
			});
    	}
    	//根据地区设置有效时段 
    	function addEffectTime(){
    		$("#addEffectTimeDiv").find("iframe").attr("src","add.html");
			$("#addEffectTimeDiv").dialog({
				title : "根据地区设置有效时段 ",
				resizable : false,
				width : 850,
				height : 600,
				resizable : true,
				modal : true,
				buttons : {
					"关闭" : function() {
						$(this).dialog("close");
					}
				}
			});
    	}
    	var schoolId="";
    	function add(id){
    		schoolId = id;
    		$("#addEffectTimeInfoDiv").dialog({
    			title : "设置有效时段",
    			resizable : false,
    			width : 600,
    			height : 400,
    			resizable : true,
    			modal : true,
    			buttons : {
    				"关闭" : function() {
    					$(this).dialog("close");
    				}
    			}
    		});
    	}
    	//绑定效时段信息
    	function bindTime(){
    		$.ajax({
    			url : "../../effectTime/add.ao?schoolId="+schoolId,
    			type : 'POST',
    			data :$("#addEffectTimeInfoForm").serialize(),
    			cache : false,
    			beforeSend : ajaxstar,
    			complete : ajaxend,
    			dataType : "json",
    			success : function(data) {
					sAlert(data["result"]);
    				if(data["state"] == "success"){
    					alert("设置成功!");
    					$("#addEffectTimeInfoDiv").dialog("close");
    					location.reload();
    				}
    			}
    		});
    	}
    	//取消
    	function quit(){
    		$("#effectTimeDiv").dialog("close");
    	}
    </script>
</body>
</html>